package com.cbhb.sys;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class ArrayPairSum {

    public static int arrayPairSum(int[] nums) {
        int sum = 0;
        Arrays.sort(nums);
        for(int i=0;i<nums.length;i++) {
            sum += (i%2==0?nums[i]:0);
        }

        Set<Integer> set = new HashSet<>();
        return sum;
    }

    public static void main(String[] args) {
        System.out.println(arrayPairSum(new int[]{1,4,3,2}));
    }
}
